/*请求url*/
var urlData = require('../../data/url.js');

Page({
  data: {
    animationData:{},
    flagChildren:true,
    flagNav:true,
    selectChildUrl: urlData.urlList.index.selectChild.url,
    userName:'',
    userRole:'',
    userGrade:'',
    news:{},
    notice:{}
  },
  onLoad:function(e){
    var that = this;
    wx.getStorage({
      key : 'loginConf',
      success : function(res){
        that.setData({
          userName : res.data.userName,
          userRole : res.data.userRole,
          userGrade : res.data.userGrade
        });
      }
    });

    wx.request({
        url:'http://192.168.1.110:8000/news/lastNews/',
        'content-type':'application/json',
        method:"get",
        data: {
          
        }, 
        header: {'content-type': 'application/x-www-form-urlencoded'},  
        success:function(res) {
          that.setData({
            news : res.data
          });
        }
    });

    wx.request({
        url:'http://192.168.1.110:8000/schoolNotice/lastNotice/',
        'content-type':'application/json',
        method:"get",
        data: {
          
        }, 
        header: {'content-type': 'application/x-www-form-urlencoded'},  
        success:function(res) {
          that.setData({
            notice : res.data
          });
        }
    });
  },
  /*
    学生社团
  */
  studentOrgan:function(e){
    if(this.data.flagNav){
      this.setData({
        flagNav : false
      });
    }else{
      this.setData({
          flagNav : true
      });
    } 
  },
  /*
    跳转到最新一条新闻的详情页
  */
  toNewsDetail:function(e){
    
  },
  /*
    跳转到：更多
  */
  toMore:function(e){
    wx.navigateTo({
      url: '../index/more/more'
    });
  },
  /*
    跳转到：选课
  */
  toSelectClass:function(e){
    wx.navigateTo({
      url: '../index/organ-manage/select-class/select-class'
    });
  },
  /*
    跳转到：社团考勤
  */
  toOrganCheck: function (e) {
    wx.navigateTo({
      url: '../index/organ-manage/organ-check/check-page/check-page'
    });
  },
  /*
    跳转到：新闻页
  */
  toNews:function(e){
    wx.navigateTo({
      url: '../index/home-school-manage/school-news/news-list/news-list'
    });
  },
  /*
    跳转到：社团作业
  */
  toOrganHomework:function(e){
    wx.navigateTo({
      url: '../index/organ-manage/organ-homework/organ-homework-list/organ-homework-list'
    });
  },
  /*
    跳转到：社团档案
  */
  toOrganRecord:function(e){
    wx.navigateTo({
      url: '../index/organ-manage/organ-record/organ-record-list/organ-record-list'
    });
  },
  /*
    跳转到：课程评价
  */
  toCourseEvaluate:function(e){
    wx.navigateTo({
      url: '../index/organ-manage/organ-check/check-page/check-page'
    });
  },
  /*
    跳转到：新闻页
  */
  toNotice:function(e){
    wx.navigateTo({
      url: '../index/home-school-manage/school-notice/inform-list/inform-list'
    });
  }
})
